using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using DTO;
using BUS;
using Utility;

public partial class admin_A_TraLoi_Them : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        LoadData();
    }

    private void LoadData()
    {
        int id = int.Parse(Request.QueryString["ID"]);
        CauHoiBinhLuan_DTO cauHoiBinhLuan = CauHoiBinhLuan_BUS.GetByID(id);
        l_ID.Text = cauHoiBinhLuan.ID.ToString();

        KhachHang_DTO khachHang = KHACHHANG_BUS.GetByID(cauHoiBinhLuan.MaKH);
        l_KhachHang.Text = khachHang.MaKH.ToString();
    }
    protected void btn_traloi_Click(object sender, EventArgs e)
    {
        try
        {
            TraLoi_DTO traLoi = new TraLoi_DTO();
            traLoi.ID = int.Parse(l_ID.Text.ToString());
            traLoi.MaKH = int.Parse(l_KhachHang.Text.ToString());
            traLoi.NoiDung = F_TraLoi.Text;
            TraLoi_BUS.Insert(traLoi);

        }
        catch (Exception ex)
        {
            //Response.Redirect(Request.RawUrl);
        }
        Response.Redirect("~/admin/A_TraLoi.aspx");
    }
}
